from redis import StrictRedis

# 传入Redis的地址、运行端口、使用的数据库、密码信息
# decode_response 必须加
redis = StrictRedis(host='localhost', port=6379, db=4, decode_responses=True) # 默认不传的情况下，四个参数分别为localhost,6379,0,None
REDIS_KEY = 'proxies:universal'

# 按score从大到小的顺序
a = redis.zrevrange(REDIS_KEY, 0, 4)
print(type(a))
print(a)
for i in a:
    print(type(i))
    print(i)

b = redis.zrevrange(REDIS_KEY, 0, 4, withscores=True)
print(b)